package com.oss.intercept.jwt;

import com.oss.utils.constants.FolderLocation;

public class JWTUtil {

	private int exprie = Integer.valueOf(FolderLocation.domainConfig().get("JWTExprie"));

	private String priKeyPath = FolderLocation.domainConfig().get("JWTPriKeyPath");

	private String pubKeyPath = FolderLocation.domainConfig().get("JWTPubKeyPath");

	public String generateToken(IJWTInfo ijwtInfo) throws Exception {
		return JWTHelper.generateToken(ijwtInfo, priKeyPath, exprie);
	}

	public IJWTInfo getInfoFromToken(String token) {
		try {
			return JWTHelper.getInfoFromToken(token, pubKeyPath);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
